# -*- coding: UTF-8 _*_
import time

import allure

from common.appbase import APPBase

red_dot = ('resourceId',"com.hpbr.bosszhipin:id/fl_tab_3_red_dot")
# messagebutton=('resourceId',"com.hpbr.bosszhipin:id/tv_tab_3")
mContent=('resourceId',"com.hpbr.bosszhipin:id/mContent")

class MessagePage():
    @allure.step("判断是否有未读消息")
    def getmessage(self, driver, pagename='消息页', elename='未读消息'):
        m = APPBase(driver)
        ele = m.isElementLocated(locator=red_dot, pagename=pagename, elename=elename)
        x=m.gettext(locator=red_dot, pagename=pagename, elename=elename)
        # print('----------------------------------'+x)
        if ele:
            m.click(locator=red_dot, pagename=pagename, elename='消息')
            time.sleep(10)
            if m.isElementLocated(locator=mContent, pagename=pagename, elename='急速处理'):
                m.clickele(locator=mContent, pagename=pagename, elename='急速处理')
                time.sleep(10)
        else:
            # print('asdfadsfasdf')
            print('tiaoguo')


    # @allure.step("进入消息页")
    # def intomessage(self, driver, pagename='消息页',elename='消息'):
    #     m = APPBase(driver)

